package org.hxyjs.dao.impl;

import org.hxyjs.dao.ActivityrecordDao;
import org.hxyjs.entity.Activityrecord;
import org.hxyjs.mapper.ActivityrecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("activityrecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class ActivityrecordDaoImpl implements ActivityrecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private ActivityrecordMapper activityrecordMapper;
    public List<Activityrecord>  getAllActivityrecords() throws Exception{
        return activityrecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteActivityrecordByArno(String arno)  throws Exception{
        return activityrecordMapper.deleteByPrimaryKey(arno);
    }

    @Override
    public Integer updateActivityrecordByArno(Activityrecord activityrecord)  throws Exception{
        return activityrecordMapper.updateByPrimaryKey(activityrecord);
    }

    @Override
    public Integer addActivityrecord(Activityrecord activityrecord)  throws Exception{
        return activityrecordMapper.insertSelective(activityrecord);
    }

}
